﻿using MyCompany.MyProject.Model.Models.RootKey;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyCompany.MyProject.Model.Models
{
    ///<summary>
    /// 部门表
    ///</summary>
    public class Department : RootEntityTKey<long>
    {
        /// <summary>
        /// 父节点id
        /// </summary>
        public long Pid { get; set; }
        /// <summary>
        /// 部门关系编码
        /// </summary>
        public string? CodeRelationship { get; set; }
        /// <summary>
        /// 部门名称
        /// </summary>
        public string? Name { get; set; }
        /// <summary>
        /// 负责人
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string? Leader { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int OrderSort { get; set; } = 0;
        /// <summary>
        /// 部门状态（0正常 1停用）
        /// </summary>
        public bool Status { get; set; } = false;
        /// <summary>
        /// 删除标志（0代表存在 2代表删除）
        /// </summary>
        public bool IsDeleted { get; set; } = false;
        /// <summary>
        /// 创建者
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string? CreateBy { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public DateTime? CreateTime { get; set; }
        /// <summary>
        /// 更新者
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string? ModifyBy { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public DateTime? ModifyTime { get; set; }

        /// <summary>
        /// 是否有子节点
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public bool hasChildren { get; set; } = true;

        /// <summary>
        /// 父节点集合
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<long>? PidArr { get; set; }
    }
}
